{extend name="./public/base"/}
{block name="alt"}admin修改个人信息{/block}
{block name="alter"}修改个人信息{/block}
{block name="title"}BangBang修改个人信息{/block}
{block name="main"}
	<div class="modal-body">
						
<input type="hidden" name="adminid" id="adminid" value="{$Think.session.adminid}" >
<div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">用户名</label>
    <div class="col-sm-4">
      <input type="text" name="adminname" class="form-control" id="adminname" value="{$Think.session.adminname}">
    </div>
  </div>
  
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">新密码</label>
    <div class="col-sm-4">
      <input type="password" name="password" class="form-control" id="password1" value="" required>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">确认密码</label>
    <div class="col-sm-4">
      <input type="password"  class="form-control"  id="password2" required>
    </div>
  </div>
  
  <button type="button" class="btn btn-primary" id="button">保存</button>

         	 	</div>
<script src="__STATIC__/assets/plugins/jquery/jquery.min.js"></script>
<script>
	$(function(){
		$("#button").click(function(){
			if ($("#password1").val()!=$("#password2").val()) {
				alert('请保持两次密码的一致');
			}else{
				$.post("{:url('doupdatepassword')}",{adminname:$("#adminname").val(),adminid:$("#adminid").val(),password:$("#password1").val()},function(data){
					// console.log(data);
          if (data=='修改成功，请重新登陆') {
					alert(data);
					$(location).attr('href', 'http://localhost/bangbang/public/index.php/superadmin/index/index.html');
        }else{
          alert(data+"，新密码不能和原密码一致");
        }
				});
			}
		})
	});
</script>
{/block}